#!/bin/bash
# 生成H2服务器所需的SSL密钥库

KEYSTORE="h2.keystore"
ALIAS="h2server"
PASSWORD="KeystoreP@ssw0rd"
VALIDITY_DAYS=365

echo "生成H2 SSL密钥库..."
keytool -genkeypair \
    -alias $ALIAS \
    -keyalg RSA \
    -keysize 2048 \
    -validity $VALIDITY_DAYS \
    -keystore $KEYSTORE \
    -storepass $PASSWORD \
    -keypass $PASSWORD \
    -dname "CN=H2 Database Server, OU=Development, O=MyCompany, L=City, ST=State, C=Country"

echo "密钥库生成完成: $KEYSTORE"
echo "请确保配置文件中的h2.ssl.keystore.password与生成密码一致"
